#include <bits/stdc++.h>

using namespace std;

long long n, L, R;

int main()
{
	freopen("candy.in", "r", stdin);
	freopen("candy.out", "w", stdout);
	scanf("%lld %lld %lld", &n, &L, &R);
	if(L / n < R / n)
	{
		printf("%lld", n - 1);
	}
	else 
	{
		printf("%lld", R % n);
	}
	return 0;
}
